package com.jy.rhin.facade.infra.controller.tongji;

import com.jy.framework.base.entity.Result;
import com.jy.rhin.application.infra.InfraStatisticsService;
import com.jy.rhin.facade.infra.controller.dto.ShiJianZXStatisticsDto;
import com.jy.rhin.infra.repo.notfication.topic.query.TopicQueryHandler;
import com.jy.rhin.sdk.dto.notification.resp.EventTopicListDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author yuyue
 * @date 2023/9/4
 */
@Api(tags = "事件总线-统计相关")
@RestController
@RequestMapping("statistics")
public class StatisticsController {

    @Autowired
    private InfraStatisticsService statisticsService;
    @Resource
    TopicQueryHandler topicQueryHandler;

    @GetMapping("shiJianZXFW")
    @ApiOperation("事件总线服务")
    public Result<ShiJianZXStatisticsDto> getShiJianZXFW() {
        return Result.success(statisticsService.getShiJianZXFW());
    }

    @GetMapping("subscribeListTop5")
    @ApiOperation("事件主题订阅top5")
    public Result<List<EventTopicListDto>> getTopicSubscribeList() {
        return Result.success(topicQueryHandler.queryEventTopicList(5));
    }

}
